package com.tongcao.cn.contoller;

import com.tongcao.cn.annotation.RateLimit;
import com.tongcao.cn.dfire.result.ResultMap;
import com.tongcao.cn.dfire.utils.ApiResultUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author:tongcao
 * @since:2019/7/9 20:05
 * Description:
 */

@Controller
public class RetaLimiterController {

    private Logger log = LoggerFactory.getLogger(this.getClass());

    @GetMapping("/rateTest")
    @RateLimit(limitNum = 2)
    @ResponseBody
    public ResultMap getResults() {
        log.info("调用了方法getResults");
        return ApiResultUtil.successResult("调用了方法");
    }

}